var removeDuplicates = function(nums) {
    const n = nums.length
    let l = 2
    for(let i=2;i<n;i++){
        if(nums[l-1]==nums[l-2]&&nums[l-1]==nums[i]){continue}
        else {
           nums[l++]=nums[i]
        }
    }
    //console.log(l);
   return l
};

removeDuplicates([1,1,1,2,2,3])